package com.three.box.network;//package com.rh.elevator.network;
//
//import static com.three.box.config.Constant.TIME_PATTERN;
//
//import androidx.annotation.NonNull;
//
//import com.three.box.config.Constant;
//import com.rh.elevator.entity.HttpHelper;
//import com.rh.elevator.helper.LogUtils;
//
//import java.io.IOException;
//import java.time.LocalDateTime;
//import java.time.format.DateTimeFormatter;
//import java.util.Locale;
//
//import okhttp3.Interceptor;
//import okhttp3.Request;
//import okhttp3.Response;
//
///**
// * 请求拦截器
// * Created by Administrator on 2018/4/10.
// */
//
//public class HeaderInterceptor implements Interceptor {
//    @NonNull
//    @Override
//    public Response intercept(Chain chain) throws IOException {
//        String timestamp = LocalDateTime.now().format(DateTimeFormatter.ofPattern(TIME_PATTERN));
//        String md5 = HttpHelper.INSTANCE.md5(Constant.KEY + timestamp + Constant.SN);
//        // 添加请求头（公共参数）
//        Request request = chain.request().newBuilder()
//                .header("deviceCode", Constant.SN)
//                .header("timestamp", timestamp)
//                .header("sign", md5.toUpperCase(Locale.ROOT))
//                .build();
//        LogUtils.INSTANCE.d("HeaderInterceptor", request.headers().toString());
//
//        return chain.proceed(request);
//    }
//}
